package com.dingqb.ktdemo.inherite

import com.dingqb.ktdemo.oop.Base2

/**Inherit**/
open class Inherited : Any {
	constructor() {
		super.toString();
		super.hashCode()
		var b: Boolean = super.equals(Child(""));
		println(b);
	}


}

fun main(args: Array<String>) {
	var a: Inherited = Inherited();
//	println(Child("122").f());
//	println(Child("123").f2());
//	println(Child("").f4(5))
//	println(Child("").f3(5));
}

open class Base(a: String) {
	open var aa: String = a.toString();
	open fun f() {
		println("base:" + aa);
	}
}


open class Child(var age: String) : Base(age), Base2 {
	override var cla: String = "123";
	override var aa: String = age;
	override fun f() {
		println("Child:" + age);

	}

	override fun ff() {};
	override fun f2() {
		super<Base>.f();
		super<Base2>.f2();
		this.f();
		println("Child - implement  interface $age");
	}

	fun f3(tt: Int): Int {// 阶乘
		if (tt == 1) {
			return 1
		};
		else return f3(tt - 1) * tt;
	}

	fun f4(tt: Int): Int {// 斐波那契数列
		println("f4()");
		if (tt <= 2) {
			return 1
		};
		else {
			return f4(tt - 1) + f4(tt - 2);
		}

	}


}


